package leetcode;

import pojo.TreeNode;

/**
 * 100. 相同的树    https://leetcode.cn/problems/same-tree/
 *
 * @author yujiafan
 * @version 1.0.0
 * @create 2022-12-27
 */
public class LeetCode100 {

    public boolean isSameTree(TreeNode p, TreeNode q) {
        if((p == null) ^ (q == null)){
            return false;
        }
        if((p == null) && (q == null)){
            return true;
        }
        return p.val == q.val && isSameTree(p.left,q.left) && isSameTree(p.right,q.right);
    }

}
